﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using XZL.GM.Bll;

public partial class Course_BannerList : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindBannerList();
        }
    }

    private void BindBannerList()
    {
        int? count = 0;
        string bannerName = txtBannerName.Text.Trim();
       
        divCondition.Visible = true;
        gridList.DataSource =BannerInfoBiz.GetBannerList(bannerName,netPager.CurrentPageIndex, netPager.PageSize, ref count);  
        gridList.DataBind();
        netPager.RecordCount = count.Value;
        lblWarn.Text = "轮播数量:" + count.Value;

    }


    /// <summary>
    /// 分页控件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void netPager_PageChanged(object sender, EventArgs e)
    {
        BindBannerList();
    }

    protected void btnSelect_Click(object sender, EventArgs e)
    {
        BindBannerList();
        netPager.CurrentPageIndex = 1;
    }


    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gridList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string bannerID = gridList.DataKeys[e.RowIndex].Value.ToString(); ;
        int bID = Convert.ToInt32(bannerID);
        bool b = BannerInfoBiz.DeleteBanner(bID);
        if (b)
        {
            lblWarn.Text = "删除成功";
            BindBannerList();
        }

    }






}